#!/usr/env/php
<?php
/**
 * only run a controller.
 */

use Inhere\Console\Examples\Controllers\HomeController;

define('BASE_PATH', dirname(__DIR__));

require dirname(__DIR__) . '/test/boot.php';

$in = new \Inhere\Console\IO\Input();
$ctrl = new HomeController($in, new \Inhere\Console\IO\Output());
$ctrl->setStandAlone();

try {
  exit($ctrl->run($in->getCommand()));
} catch (ReflectionException $e) {
  // ...
}

// can also:

// $app = new \Inhere\Console\Application([
//     'debug' => true,
//     'rootPath' => BASE_PATH,
// ]);
//
// $app->controller('home', HomeController::class);
//
// exit(
//     (int)$app->runAction('home', $app->getInput()->getCommand(), false, true)
// );
